#ifndef MIRADASWIDGET__H_
#define MIRADASWIDGET__H_

#include <QColor>
#include <QList>
#include <QPainterPath>
#include <QString>
#include <QTimeLine>
#include <QWidget>

//#include "QArm.h"
#include "QMiraIRobot2DPainter.h"
#include "MiraIRobot2D.h"
#include "MiraMXS.h"

class MiradasWidget : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(QColor bgColor   READ GetBackgroundColor WRITE SetBackgroundColor USER true)

public:
    MiradasWidget(QWidget *parent = 0);
    ~MiradasWidget();

    QColor  GetBackgroundColor() const;
    void SetBackgroundColor(const QColor& c);

    void SetArmVisibility(const int id, bool visible);

public slots:
    void StartAnimation();
    void StopAnimation();
    void RewindAnimation();
    void LoadSceneFile(const QString &fileName);
    bool LoadAnimationFile(const QString &fileName);


protected:
    void paintEvent (QPaintEvent  *event);
//    void resizeEvent(QResizeEvent *event);
//    void showEvent  (QShowEvent   *event);
    
    void drawAll_(int t);
    void drawAxis_(QPainter &painter);
    void drawArms_(QPainter &painter, const int t);    

private:
    std::unique_ptr <QMira::MXS> mxsSystemPtr_;
    QMira::QIRobot2DPainter::QIRobot2DPaintUnPtrCont_t painterColl_;
    bool fileAnimLoaded_;
       
    QColor        BackgroundColor_;
    QTimeLine     Animator_;

};

#endif // MIRADASWIDGET__H_
